package com.vision.bigDataApi.controller.oracle.gkgl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.vision.bigDataApi.enums.ReturnStatus;
import com.vision.bigDataApi.service.common.ResultService;
import com.vision.bigDataApi.service.oracle.gkgl.GkglService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/gkgl")
public class GkglController {
    @Value("${pageNum}")
    private int pageNum;

    @Value("${pageSize}")
    private int pageSize;


    @Autowired
    private ResultService resultService;
    @Autowired
    private GkglService gkglService;


    /**
     * 港口管理信息系统  经营人基础信息 ORGAN表  ENTERPRISE_EXTEND表
     * @param pageNum
     * @param pageSize
     * @return
     */
    @RequestMapping("/getByOrganAndEnterpriseExtend")
    @ResponseBody
    public String getByOrganAndEnterpriseExtend(Integer pageNum,Integer pageSize)throws Exception{
        int pageN = 0;
        int pageS=0;
        if(pageNum!=null){
            pageN=pageNum;
        }
        else{
            pageN=this.pageNum;
        }
        if(pageSize!=null){
            pageS=pageSize;
        }
        else{
            pageS=this.pageSize;
        }
        PageHelper.startPage(pageN,pageS);
        List<Map<String, Object>> listMap = gkglService.getByOrganAndEnterpriseExtend();
        PageInfo pageInfo=new PageInfo<>(listMap);
        long total = pageInfo.getTotal();
        return resultService.result(ReturnStatus.SUCCESS,listMap,"成功",total);


    }


    /**
     *  港口管理信息系统  JY_ENT_BIZ_CERT_INFO--经营许可证信息
     * @param req
     * @param resp
     * @return
     */
    @GetMapping("/getByJyEntBizCertInfo")
    @ResponseBody
    public String getByOrganAndEnterpriseExtend(HttpServletRequest req,HttpServletResponse resp)throws Exception{
        String pageNum = req.getParameter("pageNum");
        String pageSize = req.getParameter("pageSize");
        int pageN = 0;
        int pageS=0;
        if(pageNum!=null){
            pageN=Integer.valueOf(pageNum);
        }
        else{
            pageN=this.pageNum;
        }
        if(pageSize!=null){
            pageS=Integer.valueOf(pageSize);
        }
        else{
            pageS=this.pageSize;
        }
        PageHelper.startPage(pageN,pageS);
        List<Map<String, Object>> listMap = gkglService.getByJyEntBizCertInfo();
        PageInfo pageInfo=new PageInfo(listMap);
        return resultService.result(ReturnStatus.SUCCESS,listMap,"成功",pageInfo.getTotal());

    }

    /**
     *
     * 港口管理信息系统  JY_INVESTMENT--投资情况
     * @param req
     * @param resp
     * @return
     */
    @GetMapping("/getByJyInvestment")
    @ResponseBody
    public String getByJyInvestment(HttpServletRequest req,HttpServletResponse resp)throws Exception{
        String pageNum = req.getParameter("pageNum");
        String pageSize = req.getParameter("pageSize");
        String nbGkjyfr = req.getParameter("nbGkjyfr");
        int pageN = 0;
        int pageS=0;
        if(pageNum!=null){
            pageN=Integer.valueOf(pageNum);
        }
        else{
            pageN=this.pageNum;
        }
        if(pageSize!=null){
            pageS=Integer.valueOf(pageSize);
        }
        else{
            pageS=this.pageSize;
        }
        PageHelper.startPage(pageN,pageS);
        List<Map<String, Object>> listMap = gkglService.getByJyInvestment(nbGkjyfr);
        PageInfo pageInfo=new PageInfo(listMap);
        return  resultService.result(ReturnStatus.SUCCESS,listMap,"成功",pageInfo.getTotal());
    }


    /**
     *港口管理信息系统  JY_LANDWATER_SHORE--陆水域自然岸线使用信息
     * @param req
     * @param resp
     * @return
     */
    @GetMapping("/getByJyLandwaterShore")
    @ResponseBody
    public String getByJyLandwaterShore(HttpServletRequest req, HttpServletResponse resp)throws Exception{
        String pageNum = req.getParameter("pageNum");
        String pageSize = req.getParameter("pageSize");
        String nbGkjyfr = req.getParameter("nbGkjyfr");
        int pageN = 0;
        int pageS=0;
        if(pageNum!=null){
            pageN=Integer.valueOf(pageNum);
        }
        else{
            pageN=this.pageNum;
        }
        if(pageSize!=null){
            pageS=Integer.valueOf(pageSize);
        }
        else{
            pageS=this.pageSize;
        }
        PageHelper.startPage(pageN,pageS);
        List<Map<String, Object>> listMap = gkglService.getByJyLandwaterShore(nbGkjyfr);
        PageInfo pageInfo=new PageInfo(listMap);
        return  resultService.result(ReturnStatus.SUCCESS,listMap,"成功",pageInfo.getTotal());
    }


    /**
     * 港口管理信息系统  JY_LOAD_EQUIPMENT--装卸机械信息
     * @param req
     * @param resp
     * @return
     */
    @GetMapping("/getByJyLoadEquipment")
    @ResponseBody
    public String getByJyLoadEquipment(HttpServletRequest req, HttpServletResponse resp)throws Exception{
        String pageNum = req.getParameter("pageNum");
        String pageSize = req.getParameter("pageSize");
        String nbGkjyfr = req.getParameter("nbGkjyfr");
        int pageN = 0;
        int pageS=0;
        if(pageNum!=null){
            pageN=Integer.valueOf(pageNum);
        }
        else{
            pageN=this.pageNum;
        }
        if(pageSize!=null){
            pageS=Integer.valueOf(pageSize);
        }
        else{
            pageS=this.pageSize;
        }
        PageHelper.startPage(pageN,pageS);
        List<Map<String, Object>> listMap = gkglService.getByJyLoadEquipment(nbGkjyfr);
        PageInfo pageInfo=new PageInfo(listMap);
        return  resultService.result(ReturnStatus.SUCCESS,listMap,"成功",pageInfo.getTotal());
    }


    /**
     *        港口管理信息系统   GANG_KOU_SHE_SHI 港口设施信息
     * @param req
     * @param resp
     * @return
     */
    @GetMapping("/getByGangKouSheShi")
    @ResponseBody
    public String getByGangKouSheShi(HttpServletRequest req, HttpServletResponse resp)throws Exception{
        String pageNum = req.getParameter("pageNum");
        String pageSize = req.getParameter("pageSize");
        int pageN = 0;
        int pageS=0;
        if(pageNum!=null){
            pageN=Integer.valueOf(pageNum);
        }
        else{
            pageN=this.pageNum;
        }
        if(pageSize!=null){
            pageS=Integer.valueOf(pageSize);
        }
        else{
            pageS=this.pageSize;
        }
        PageHelper.startPage(pageN,pageS);
        List<Map<String, Object>> listMap = gkglService.getByGangKouSheShi();
        PageInfo pageInfo=new PageInfo(listMap);
        return  resultService.result(ReturnStatus.SUCCESS,listMap,"成功",pageInfo.getTotal());
    }


    /**
     *港口管理信息系统  JCSJ_GK_MTJBQK--码头基本信息
     * @param req
     * @param resp
     * @return
     */
    @GetMapping("/getByJcsjGkMtjbqk")
    @ResponseBody
    public String getByJcsjGkMtjbqk(HttpServletRequest req, HttpServletResponse resp)throws Exception{
        String pageNum = req.getParameter("pageNum");
        String pageSize = req.getParameter("pageSize");
        int pageN = 0;
        int pageS=0;
        if(pageNum!=null){
            pageN=Integer.valueOf(pageNum);
        }
        else{
            pageN=this.pageNum;
        }
        if(pageSize!=null){
            pageS=Integer.valueOf(pageSize);
        }
        else{
            pageS=this.pageSize;
        }
        PageHelper.startPage(pageN,pageS);
        List<Map<String, Object>> listMap = gkglService.getByJcsjGkMtjbqk();
        PageInfo pageInfo=new PageInfo(listMap);
        return  resultService.result(ReturnStatus.SUCCESS,listMap,"成功",pageInfo.getTotal());
    }


    /**
     * 港口管理信息系统 JCSJ_GK_DDJSCBW--泊位基本信息
     * @param req
     * @param resp
     * @return
     */
    @GetMapping("/getByJcsjGkDdjscbw")
    @ResponseBody
    public String getByJcsjGkDdjscbw(HttpServletRequest req, HttpServletResponse resp)throws Exception{
        String pageNum = req.getParameter("pageNum");
        String pageSize = req.getParameter("pageSize");
        int pageN = 0;
        int pageS=0;
        if(pageNum!=null){
            pageN=Integer.valueOf(pageNum);
        }
        else{
            pageN=this.pageNum;
        }
        if(pageSize!=null){
            pageS=Integer.valueOf(pageSize);
        }
        else{
            pageS=this.pageSize;
        }
        PageHelper.startPage(pageN,pageS);
        List<Map<String, Object>> listMap = gkglService.getByJcsjGkDdjscbw();
        PageInfo pageInfo=new PageInfo(listMap);
        return  resultService.result(ReturnStatus.SUCCESS,listMap,"成功",pageInfo.getTotal());
    }


    /**
     *港口管理信息系统  JCSJ_GK_DC  --堆场基本信息
     * @param req
     * @param resp
     * @return
     */
    @GetMapping("/getByJcsjGkDc")
    @ResponseBody
    public String getByJcsjGkDc(HttpServletRequest req, HttpServletResponse resp)throws Exception{
        String pageNum = req.getParameter("pageNum");
        String pageSize = req.getParameter("pageSize");
        int pageN = 0;
        int pageS=0;
        if(pageNum!=null){
            pageN=Integer.valueOf(pageNum);
        }
        else{
            pageN=this.pageNum;
        }
        if(pageSize!=null){
            pageS=Integer.valueOf(pageSize);
        }
        else{
            pageS=this.pageSize;
        }
        PageHelper.startPage(pageN,pageS);
        List<Map<String, Object>> listMap = gkglService.getByJcsjGkDc();
        PageInfo pageInfo=new PageInfo(listMap);
        return  resultService.result(ReturnStatus.SUCCESS,listMap,"成功",pageInfo.getTotal());
    }


    /**
     * 港口管理信息系统 B_JCSJ_GK_CK --仓库基本信息
     * @param req
     * @param resp
     * @return
     */
    @GetMapping("/getByBJcsjGKcK")
    @ResponseBody
    public String getByBJcsjGKcK(HttpServletRequest req, HttpServletResponse resp)throws Exception{
        String pageNum = req.getParameter("pageNum");
        String pageSize = req.getParameter("pageSize");
        int pageN = 0;
        int pageS=0;
        if(pageNum!=null){
            pageN=Integer.valueOf(pageNum);
        }
        else{
            pageN=this.pageNum;
        }
        if(pageSize!=null){
            pageS=Integer.valueOf(pageSize);
        }
        else{
            pageS=this.pageSize;
        }
        PageHelper.startPage(pageN,pageS);
        List<Map<String, Object>> listMap = gkglService.getByBJcsjGKcK();
        PageInfo pageInfo=new PageInfo(listMap);
        return  resultService.result(ReturnStatus.SUCCESS,listMap,"成功",pageInfo.getTotal());
    }


    /**
     * 港口管理信息系统 JCSJ_GK_GKJBXX  港口基本信息
     * @param req
     * @param resp
     * @return
     */
    @GetMapping("/getByJcsjGkGkjbxx")
    @ResponseBody
    public String getByJcsjGkGkjbxx(HttpServletRequest req, HttpServletResponse resp)throws Exception{
        String pageNum = req.getParameter("pageNum");
        String pageSize = req.getParameter("pageSize");
        int pageN = 0;
        int pageS=0;
        if(pageNum!=null){
            pageN=Integer.valueOf(pageNum);
        }
        else{
            pageN=this.pageNum;
        }
        if(pageSize!=null){
            pageS=Integer.valueOf(pageSize);
        }
        else{
            pageS=this.pageSize;
        }
        PageHelper.startPage(pageN,pageS);
        List<Map<String, Object>> listMap = gkglService.getByJcsjGkGkjbxx();
        PageInfo pageInfo=new PageInfo(listMap);
        return  resultService.result(ReturnStatus.SUCCESS,listMap,"成功",pageInfo.getTotal());
    }


    /**
     * 港口管理信息系统 JCSJ_GK_GQJBQK   港区基本信息
     * @param req
     * @param resp
     * @return
     */
    @GetMapping("/getByJcsjGkGqjbqk")
    @ResponseBody
    public String getByJcsjGkGqjbqk(HttpServletRequest req, HttpServletResponse resp)throws Exception{
        String pageNum = req.getParameter("pageNum");
        String pageSize = req.getParameter("pageSize");
        int pageN = 0;
        int pageS=0;
        if(pageNum!=null){
            pageN=Integer.valueOf(pageNum);
        }
        else{
            pageN=this.pageNum;
        }
        if(pageSize!=null){
            pageS=Integer.valueOf(pageSize);
        }
        else{
            pageS=this.pageSize;
        }
        PageHelper.startPage(pageN,pageS);
        List<Map<String, Object>> listMap = gkglService.getByJcsjGkGqjbqk();
        PageInfo pageInfo=new PageInfo(listMap);
        return  resultService.result(ReturnStatus.SUCCESS,listMap,"成功",pageInfo.getTotal());
    }


    /**
     * 港口管理信息系统 JCSJ_GK_JGHD  航道基本信息
     * @param req
     * @param resp
     * @return
     */
    @GetMapping("/getByJcsjGkJghd")
    @ResponseBody
    public String getByJcsjGkJghd(HttpServletRequest req, HttpServletResponse resp)throws Exception{
        String pageNum = req.getParameter("pageNum");
        String pageSize = req.getParameter("pageSize");
        int pageN = 0;
        int pageS=0;
        if(pageNum!=null){
            pageN=Integer.valueOf(pageNum);
        }
        else{
            pageN=this.pageNum;
        }
        if(pageSize!=null){
            pageS=Integer.valueOf(pageSize);
        }
        else{
            pageS=this.pageSize;
        }
        PageHelper.startPage(pageN,pageS);
        List<Map<String, Object>> listMap = gkglService.getByJcsjGkJghd();
        PageInfo pageInfo=new PageInfo(listMap);
        return  resultService.result(ReturnStatus.SUCCESS,listMap,"成功",pageInfo.getTotal());
    }


    /**
     * 港口管理信息系统 JCSJ_GK_GKMD  锚地基本信息
     * @param req
     * @param resp
     * @return
     */
    @GetMapping("/getByJcsjGkGkmd")
    @ResponseBody
    public String getByJcsjGkGkmd(HttpServletRequest req, HttpServletResponse resp)throws Exception{
        String pageNum = req.getParameter("pageNum");
        String pageSize = req.getParameter("pageSize");
        int pageN = 0;
        int pageS=0;
        if(pageNum!=null){
            pageN=Integer.valueOf(pageNum);
        }
        else{
            pageN=this.pageNum;
        }
        if(pageSize!=null){
            pageS=Integer.valueOf(pageSize);
        }
        else{
            pageS=this.pageSize;
        }
        PageHelper.startPage(pageN,pageS);
        List<Map<String, Object>> listMap = gkglService.getByJcsjGkGkmd();
        PageInfo pageInfo=new PageInfo(listMap);
        return  resultService.result(ReturnStatus.SUCCESS,listMap,"成功",pageInfo.getTotal());
    }

}
